package com.netease.image.video;

import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Path;
import android.graphics.Path.Direction;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Region.Op;
import android.graphics.drawable.Drawable;
import android.view.View;
import com.netease.g.b;

class ao
{
  public static final int b = 1;
  public static final int c = 2;
  public static final int d = 4;
  public static final int e = 8;
  public static final int f = 16;
  public static final int g = 32;
  private static final String m = "HighlightView";
  View a;
  boolean h;
  boolean i;
  Rect j;
  RectF k;
  Matrix l;
  private m n = m.a;
  private RectF o;
  private boolean p = false;
  private float q;
  private Drawable r;
  private Drawable s;
  private final Paint t = new Paint();
  private final Paint u = new Paint();
  private final Paint v = new Paint();

  public ao(View paramView)
  {
    this.a = paramView;
  }

  private void d()
  {
    Resources localResources = this.a.getResources();
    this.r = localResources.getDrawable(2130837567);
    this.s = localResources.getDrawable(2130837566);
  }

  private Rect e()
  {
    RectF localRectF = new RectF(this.k.left, this.k.top, this.k.right, this.k.bottom);
    this.l.mapRect(localRectF);
    return new Rect(Math.round(localRectF.left), Math.round(localRectF.top), Math.round(localRectF.right), Math.round(localRectF.bottom));
  }

  public int a(float paramFloat1, float paramFloat2)
  {
    int i1 = 0;
    Rect localRect = e();
    int i2;
    if ((paramFloat2 >= localRect.top - 20.0F) && (paramFloat2 < 20.0F + localRect.bottom))
    {
      i2 = 1;
      if ((paramFloat1 >= localRect.left - 20.0F) && (paramFloat1 < 20.0F + localRect.right))
        i1 = 1;
      if ((Math.abs(localRect.left - paramFloat1) >= 20.0F) || (i2 == 0))
        break label216;
    }
    label216: for (int i3 = 3; ; i3 = 1)
    {
      if ((Math.abs(localRect.right - paramFloat1) < 20.0F) && (i2 != 0))
        i3 |= 4;
      if ((Math.abs(localRect.top - paramFloat2) < 20.0F) && (i1 != 0))
        i3 |= 8;
      if ((Math.abs(localRect.bottom - paramFloat2) < 20.0F) && (i1 != 0));
      for (int i4 = i3 | 0x10; ; i4 = i3)
      {
        if ((i4 == 1) && (localRect.contains((int)paramFloat1, (int)paramFloat2)))
          i4 = 32;
        return i4;
        i2 = 0;
        break;
      }
    }
  }

  void a(int paramInt, float paramFloat1, float paramFloat2)
  {
    Rect localRect = e();
    if (paramInt == 1);
    while (true)
    {
      return;
      if (paramInt != 32)
        break;
      b(paramFloat1 * (this.k.width() / localRect.width()), paramFloat2 * (this.k.height() / localRect.height()));
    }
    if ((paramInt & 0x6) == 0)
      paramFloat1 = 0.0F;
    if ((paramInt & 0x18) == 0)
      paramFloat2 = 0.0F;
    float f1 = paramFloat1 * (this.k.width() / localRect.width());
    float f2 = paramFloat2 * (this.k.height() / localRect.height());
    int i1;
    label121: float f3;
    if ((paramInt & 0x2) != 0)
    {
      i1 = -1;
      f3 = f1 * i1;
      if ((paramInt & 0x8) == 0)
        break label161;
    }
    label161: for (int i2 = -1; ; i2 = 1)
    {
      c(f3, f2 * i2);
      break;
      i1 = 1;
      break label121;
    }
  }

  protected void a(Canvas paramCanvas)
  {
    if (this.i);
    Path localPath;
    while (true)
    {
      return;
      paramCanvas.save();
      localPath = new Path();
      if (a())
        break;
      this.v.setColor(-16777216);
      paramCanvas.drawRect(this.j, this.v);
    }
    Rect localRect = new Rect();
    this.a.getDrawingRect(localRect);
    localPath.addRect(new RectF(this.j), Path.Direction.CW);
    this.v.setColor(-30208);
    paramCanvas.clipPath(localPath, Region.Op.DIFFERENCE);
    if (a());
    for (Paint localPaint = this.t; ; localPaint = this.u)
    {
      paramCanvas.drawRect(localRect, localPaint);
      paramCanvas.restore();
      paramCanvas.drawPath(localPath, this.v);
      if (this.n != m.c)
        break;
      int i1 = 1 + this.j.left;
      int i2 = 1 + this.j.right;
      int i3 = 4 + this.j.top;
      int i4 = 3 + this.j.bottom;
      int i5 = this.r.getIntrinsicWidth() / 2;
      int i6 = this.r.getIntrinsicHeight() / 2;
      int i7 = this.s.getIntrinsicHeight() / 2;
      int i8 = this.s.getIntrinsicWidth() / 2;
      int i9 = this.j.left + (this.j.right - this.j.left) / 2;
      int i10 = this.j.top + (this.j.bottom - this.j.top) / 2;
      this.r.setBounds(i1 - i5, i10 - i6, i1 + i5, i10 + i6);
      this.r.draw(paramCanvas);
      this.r.setBounds(i2 - i5, i10 - i6, i2 + i5, i10 + i6);
      this.r.draw(paramCanvas);
      this.s.setBounds(i9 - i8, i3 - i7, i9 + i8, i3 + i7);
      this.s.draw(paramCanvas);
      this.s.setBounds(i9 - i8, i4 - i7, i9 + i8, i4 + i7);
      this.s.draw(paramCanvas);
      break;
    }
  }

  public void a(Matrix paramMatrix, Rect paramRect, RectF paramRectF, boolean paramBoolean)
  {
    this.l = new Matrix(paramMatrix);
    this.k = paramRectF;
    this.o = new RectF(paramRect);
    this.p = paramBoolean;
    this.q = (this.k.width() / this.k.height());
    this.j = e();
    this.t.setARGB(125, 50, 50, 50);
    this.u.setARGB(125, 50, 50, 50);
    this.v.setStrokeWidth(3.0F);
    this.v.setStyle(Paint.Style.STROKE);
    this.v.setAntiAlias(true);
    this.n = m.a;
    d();
  }

  public void a(m paramm)
  {
    if (paramm != this.n)
    {
      this.n = paramm;
      this.a.invalidate();
    }
  }

  public void a(boolean paramBoolean)
  {
    this.h = paramBoolean;
  }

  public boolean a()
  {
    return this.h;
  }

  public Rect b()
  {
    return new Rect((int)this.k.left, (int)this.k.top, (int)this.k.right, (int)this.k.bottom);
  }

  void b(float paramFloat1, float paramFloat2)
  {
    Rect localRect = new Rect(this.j);
    this.k.offset(paramFloat1, paramFloat2);
    this.k.offset(Math.max(0.0F, this.o.left - this.k.left), Math.max(0.0F, this.o.top - this.k.top));
    this.k.offset(Math.min(0.0F, this.o.right - this.k.right), Math.min(0.0F, this.o.bottom - this.k.bottom));
    this.j = e();
    localRect.union(this.j);
    localRect.inset(-10, -10);
    this.a.invalidate(localRect);
  }

  public void b(boolean paramBoolean)
  {
    this.i = paramBoolean;
  }

  public void c()
  {
    this.j = e();
  }

  void c(float paramFloat1, float paramFloat2)
  {
    RectF localRectF;
    float f1;
    float f2;
    if (this.p)
    {
      if (paramFloat1 != 0.0F)
        paramFloat2 = paramFloat1 / this.q;
    }
    else
    {
      localRectF = new RectF(this.k);
      if ((paramFloat1 <= 0.0F) || (localRectF.width() + 2.0F * paramFloat1 <= this.o.width()))
        break label474;
      paramFloat1 = (this.o.width() - localRectF.width()) / 2.0F;
      if (!this.p)
        break label474;
      f1 = paramFloat1 / this.q;
      f2 = paramFloat1;
    }
    while (true)
    {
      if ((f1 > 0.0F) && (localRectF.height() + 2.0F * f1 > this.o.height()))
      {
        f1 = (this.o.height() - localRectF.height()) / 2.0F;
        if (this.p)
          f2 = f1 * this.q;
      }
      b.c("HighlightView", "dx is: " + f2 + "dy is: " + f1);
      localRectF.inset(-f2, -f1);
      label218: float f3;
      if ((localRectF.width() <= 152.0F) || (localRectF.height() <= 15.0F))
      {
        return;
        if (paramFloat2 != 0.0F)
        {
          paramFloat1 = paramFloat2 * this.q;
          break;
        }
      }
      else
      {
        if (localRectF.width() < 25.0F)
          localRectF.inset(-(25.0F - localRectF.width()) / 2.0F, 0.0F);
        if (!this.p)
          break label394;
        f3 = 25.0F / this.q;
        label279: if (localRectF.height() < f3)
          localRectF.inset(0.0F, -(f3 - localRectF.height()) / 2.0F);
        if (localRectF.left >= this.o.left)
          break label402;
        localRectF.offset(this.o.left - localRectF.left, 0.0F);
        label336: if (localRectF.top >= this.o.top)
          break label438;
        localRectF.offset(0.0F, this.o.top - localRectF.top);
      }
      while (true)
      {
        this.k.set(localRectF);
        this.j = e();
        this.a.invalidate();
        break label218;
        break;
        label394: f3 = 25.0F;
        break label279;
        label402: if (localRectF.right <= this.o.right)
          break label336;
        localRectF.offset(-(localRectF.right - this.o.right), 0.0F);
        break label336;
        label438: if (localRectF.bottom <= this.o.bottom)
          continue;
        localRectF.offset(0.0F, -(localRectF.bottom - this.o.bottom));
      }
      label474: f1 = paramFloat2;
      f2 = paramFloat1;
    }
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.image.video.ao
 * JD-Core Version:    0.6.0
 */